home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #2 / Monster Media No. 2 (Monster Media)(1994).ISO / prog_gen / ada_tutr.zip / UNIX.ADA < prev    next >
Text File  |  1994-08-22  |  2KB  |  46 lines

  1. -- UNIX.ADA   Ver. 3.00   22-AUG-1994   Copyright 1988-1994 John J. Herro
  2. -- Software Innovations Technology
  3. -- 1083 Mandarin Drive NE, Palm Bay, FL  32905-4706   (407)951-0233
  4. --
  5. -- Compile this before compiling ADA_TUTR.ADA on a UNIX based system.  You must
  6. -- also compile ONECHAR.C or ALTCHAR.C with a C compiler before linking.  See
  7. -- first page of ADA_TUTR.ADA for more details.
  8. --
  9. with Text_IO;
  10. package Custom_IO is
  11.    type Color is (Black, Red, Green, Yellow, Blue, Magenta, Cyan, White);
  12.    Foregrnd_Color   : Color := White;                 -- Default values in case
  13.    Backgrnd_Color   : Color := Black;                 -- ADA-TUTR finds no User
  14.    Border_Color     : Color := Black;                 -- File.
  15.    Fore_Color_Digit : Character := Character'Val(Color'Pos(Foregrnd_Color)+48);
  16.    Back_Color_Digit : Character := Character'Val(Color'Pos(Backgrnd_Color)+48);
  17.    Normal_Colors    : String(1 .. 10) := ASCII.ESC & "[0;3" &
  18.                               Fore_Color_Digit & ";4" & Back_Color_Digit & "m";
  19.    Clear_Scrn       : constant String := ASCII.ESC & "[H" & ASCII.ESC & "[2J";
  20.  
  21.    procedure Set_Border_Color (To   : in  Color);
  22.    procedure Get              (Char : out Character);
  23.    procedure Put              (Char : in  Character) renames Text_IO.Put;
  24.    procedure Put              (Str  : in  String)    renames Text_IO.Put;
  25.    procedure Put_Line         (Str  : in  String)    renames Text_IO.Put_Line;
  26.    procedure Get_Line         (Str  : out String;
  27.                                Last : out Natural)   renames Text_IO.Get_Line;
  28.    procedure New_Line      (Spacing : in  Text_IO.Count := 1)
  29.                                                      renames Text_IO.New_Line;
  30. end Custom_IO;
  31.  
  32. package body Custom_IO is
  33.    procedure Set_Border_Color(To : in Color) is
  34.       -- Dummy procedure for computers other than PCs.
  35.    begin
  36.       null;
  37.    end Set_Border_Color;
  38.  
  39.    procedure Get(Char : out Character) is
  40.       function Onechar return Character;
  41.       pragma Interface (C, Onechar);            -- Pragma Interface is used for
  42.    begin                                        -- compatibility with Ada 83.
  43.       Char := Onechar;
  44.    end Get;
  45. end Custom_IO;
  46.